<?php
/**
 * Created by PhpStorm.
 * User: maple
 * Date: 17-11-24
 * Time: 下午2:30
 */

namespace AppBundle\Services;


use GuzzleHttp\Client;

class ForwardService extends BaseService
{
    /**
     * @var Client
     */
    private $client;

    /**
     * ForwardService constructor.
     * @param $client
     */
    public function __construct()
    {
        $this->client = new Client();
    }


    public function forward($content, $url, $method)
    {
        $response = $this->client->request($method, $url, [
           'body' => $content,
           'headers' => [
               'Content-Type' => 'application/xml; charset=utf-8',
           ]
       ]);
       return [
           'errorCode' => '0000',
           'errorMsg' => 'success',
           'result' => (string)$response->getBody()
       ];
    }
}